<template>
    <div>
        <h2>增加</h2>
        <InputElement v-model="student.name">姓名</InputElement>
        <InputElement v-model="student.age">年龄</InputElement>
        <RadioElement v-model="student.gender" name="addGender">性别</RadioElement>
        <input type="button" value="增加" @click="handleClick" />
    </div>
</template>

<script>
import InputElement from "../InputElement.vue";
import RadioElement from "../RadioElement.vue";
import {insert} from '../../services/student';
export default {
    components: { InputElement, RadioElement },
    data() {
        return {
            student: {
            },
        };
    },
    methods: {
        async handleClick() {
            console.log(this.student);
            await insert(this.student);
            this.$emit('show');
        },
    },
};
</script>

<style>
</style>